#ifndef CHATPAGE_H
#define CHATPAGE_H

#include "userdata.h"

#include <QWidget>


namespace Ui {
class ChatPage;
}

// 聊天信息展示界面类 TODO
class ChatPage : public QWidget
{
    Q_OBJECT

public:
    explicit ChatPage(QWidget *parent = nullptr);
    ~ChatPage();

    void setUserInfo(std::shared_ptr<UserInfo> user_info);
    void appendChatMsg(std::shared_ptr<TextChatData> msg);

protected:
    void paintEvent(QPaintEvent *event);

private slots:
    // 发送消息
    void on_send_btn_clicked();
    // 接受消息
    void on_receive_btn_clicked();

signals:
    // 发送聊天消息的信号
    void sig_append_send_chat_msg(std::shared_ptr<TextChatData> msg);

private:
    Ui::ChatPage *ui;
    std::shared_ptr<UserInfo> m_user_info;
    QMap<QString, QWidget*>  m_bubble_map;
};

#endif // CHATPAGE_H
